<% %>
<table class="TimeTrack" id="TimeTrack">
 <tr class="th">
   <td width=15%><%='Project name'.t%></td>
   <td width=5%><%='Username'.t%></td>
   <td width=5%><%='Hours'.t%></td>
   <td width=10%><%='Start - End'.t%></td>
   <td width=10%><%='Time type'.t%></td>
   <td width=55%><%='Work desc'.t%>
		       <b>
			   <%if @show == "confirmed"%>
                <%=link_to_remote "Cancel Page".t,
								  :loading=>visual_effect(:highlight,'TimeTrack',:duration=>2.5),
				                  :url=>{:action=>'unconfirm_page'}
			    %>
			   <%else%>
                <%=link_to_remote "Confirm Page".t,
								  :loading=>visual_effect(:highlight,'TimeTrack',:duration=>2.5),
				                  :url=>{:action=>'confirm_page'}
			    %>
			    <%end%>
				</b>
   </td>
   <td width=4%><%='Admin'.t-%>
   </td>
 </tr>
 <%@time_logs.each do |time_log|%>
  <tr id='entry_<%=time_log.id.to_s%>'
	   <%=time_log.after_work_time == 1 ? " class=after_work_time" : ""%>
    > 
    <td><%= link_to time_log.project.name,:controller=>'project',:action=>'show',:id=>time_log.project.id %></td>
    <td><%= link_to time_log.user.name,:controller=>'user',:action=>'show',:id=>time_log.user.id %></td>
	<td class="hours"><%=sprintf('%0.2f',(time_log.end_at - time_log.start_at)/3600) %></td>
	<td class="start"><%=time_log.start_at.to_formatted_s(:start_time)%> - <%=time_log.end_at.to_formatted_s(:end_time)%></td>
	<td>
	   <%=time_log.after_work_time == 1 ? "after work time".t : "work time".t%>
	</td>
    <td class='desc'>
	 <%if not time_log.activity_type.nil?%>
	   <%="[" + time_log.activity_type.name + "]"%>
	 <%end%>
	 <%if (desc_size = time_log.work_desc.size) > 1 %>
	 <span><%=link_to((desc_size / 3).to_s + "fonts".t,"#",:onmouseover=>"Element.show('desc_" + time_log.id.to_s + "')",:onmouseout=>"Element.hide('desc_" + time_log.id.to_s + "')")%></span>
	 <div id=desc_<%=time_log.id%> style="display:none"><%=time_log.work_desc%></div>
	 <%end%>
	 </td>
    <td class="action">
	<%if time_log.confirmed != 1 %>
	  <%= link_to_remote 'Confirm'.t, 
						 :update  => 'managed_projects',
						 :loading => visual_effect(:highlight, "entry_#{time_log.id}", :duration =>1.5),
	                     :url=>{:controller=>'login',:action => 'confirm', :id => time_log.id}
						 %>
	<%else%>
	  <%= link_to_remote 'Unconfirm'.t, 
						 :update  => 'managed_projects',
						 :loading => visual_effect(:highlight, "entry_#{time_log.id}", :duration =>1.5),
	                     :url=>{:action => 'unconfirm', :id => time_log.id}
						 %>
	<%end%>
	  <%= link_to 'Edit'.t, :controller=>'time_logs',:action => 'edit', :id => time_log, :back=>'success' %>
      <%= link_to_remote image_tag("trash.gif",:border=>0), 
	                     :update=>'managed_projects',
						 :loading => visual_effect(:highlight, "entry_#{time_log.id}", :duration =>1.5),
	                     :url=>{:action => 'destroy', :id => time_log.id,:action_name=>controller.action_name,:pid=>session[:pid],:show=>session[:show]},
						 :confirm => 'Are you sure?'.t
						 %>
	  <span id='indicator_<%=time_log.id%>' style="display:none">
	  <%=image_tag 'indicator.gif'%>
	  </span>
	</td>
  </tr>
  <%end%>
 <%if @time_log_pages.page_count > 1 %>
 <tr><td colspan=7 class='page'>
  <%= link_to '<<', :page=>@time_log_pages.current.previous,:action=>'show_logs' if @time_log_pages.current.previous %>
  <%=pagination_links(@time_log_pages,:params=>{:action=>'show_logs'})%>
  <%= link_to '>>',:page=>@time_log_pages.current.next,:action=>'show_logs' if @time_log_pages.current.next %> 
 </td></tr>
 <%end%>
</table>















